//登录
let ii = GetUser("userl");
// console.log(ii);
function check(thisform) {
  var namev = document.getElementById("user").value;
  var pass = document.getElementById("pwd").value;
  var userId = document.getElementById("userId");
  var pwdId = document.getElementById("pwdId");
  if ((namev == "admin" && pass == "123456") || (namev == "store" && pass == "456789")) {
    // alert("登录成功");
    layer.msg("登录成功", { icon: 1, time: 500 });
    window.document.f.action = "index.html";
    window.document.f.submit();
    for (let i = 0; i < userInfo.length; i++) {
      if (userInfo[i].username == namev && userInfo[i].pwd == pass) {
        var userlocal = userInfo[i];
      }
    }
    //初始化数据
    var userl = "userl";
    addUser(userl, userlocal);
    addUser("userType", userType);
    addUser("goodspj", goodspj);
    addUser("storeguanli",storeguanli);
    addUser("management",management);
    // var NewuserInfologin = [namev, pass];
    // localStorage.setItem("userInfologin", NewuserInfologin);
    // console.log(NewuserInfologin);
    // console.log(localStorage.getItem("userInfologin"));
  } else {
    if (namev != "admin" && namev != "store") {
      userId.innerText = "X 账号错误";
    }
    if (pwd != "123456" && pwd != "456789") {
      pwdId.innerText = "X 密码错误";
    }
  }
}
